package com.tengju.data.domain.model.wx;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * @author: 李大仙
 * @date: 2021/11/7 5:09 下午
 */
@Getter
@JsonFormat(shape = JsonFormat.Shape.OBJECT)
@AllArgsConstructor
public enum WxRequestRecordType {
    CREATE_DEPARTMENT(10),
    CREATE_DEALER_DEPARTMENT(11),
    CREATE_DEPARTMENT_LIMIT_ACCESS_TO_OUTSIDE_DEPARTMENTS_TAG(12),
    DELETE_DEPARTMENT(20),
    UPDATE_DEPARTMENT(30),

    CREATE_USER_DEPARTMENT(40),
    DELETE_USER_DEPARTMENT(50),
    UPDATE_USER_DEPARTMENT(60),

    ADD_INTO_CURRENT_DEPARTMENT(61),
    MOVE_OUT_CURRENT_DEPARTMENT(62),
    ADD_INTO_DEALER_DEPARTMENT(63),
    MOVE_OUT_DEALER_DEPARTMENT(64),
    HISTORY_ADD_INTO_CURRENT_DEPARTMENT(65),
    HISTORY_MOVE_OUT_CURRENT_DEPARTMENT(66),
    ;

    private Integer code;

    public static WxRequestRecordType form(Integer code) {
        if (code == null) {
            return null;
        }
        for (WxRequestRecordType status : values()) {
            if (status.code.equals(code)) {
                return status;
            }
        }
        return null;
    }

}
